Telegram Group & Telegram Channel
#нововведение

PEP 695 был принят! 🚨

PEP 695

В ближайщее время произойдут значительные изменения в синтаксе тайпваров и дженериков.
Вот как сейчас мы создаём generic type alias:

from typing import TypeAlias

_T = TypeVar("_T")

ListOrSet: TypeAlias = list[_T] | set[_T]

Теперь с утверждением данного пепа, это будет выглядить так:

type ListOrSet[T] = list[T] | set[T]

Кроме того синтаксис использования дженериков в классах также упростили.
Теперь он выглядить так:

class ClassA[T: str]:
def method1(self) -> T:
...


Где T - TypeVar.

Подробнее можно почитать об изменения тут.

Что вы думате по поводу подобных изменений? Считаете ли вы введение "var подобных" объявлений, хорошим вектором развития синтаксиса питона? 🤔



tg-me.com/pythonturboru/402
Create:
Last Update:

#нововведение

PEP 695 был принят! 🚨

PEP 695

В ближайщее время произойдут значительные изменения в синтаксе тайпваров и дженериков.
Вот как сейчас мы создаём generic type alias:

from typing import TypeAlias

_T = TypeVar("_T")

ListOrSet: TypeAlias = list[_T] | set[_T]

Теперь с утверждением данного пепа, это будет выглядить так:

type ListOrSet[T] = list[T] | set[T]

Кроме того синтаксис использования дженериков в классах также упростили.
Теперь он выглядить так:

class ClassA[T: str]:
def method1(self) -> T:
...


Где T - TypeVar.

Подробнее можно почитать об изменения тут.

Что вы думате по поводу подобных изменений? Считаете ли вы введение "var подобных" объявлений, хорошим вектором развития синтаксиса питона? 🤔

BY Python Turbo. Уютное сообщество Python разработчиков.




Share with your friend now:
tg-me.com/pythonturboru/402

View MORE
Open in Telegram


Python Turbo Уютное сообщество Python разработчиков Telegram | DID YOU KNOW?

Date: |

In many cases, the content resembled that of the marketplaces found on the dark web, a group of hidden websites that are popular among hackers and accessed using specific anonymising software.“We have recently been witnessing a 100 per cent-plus rise in Telegram usage by cybercriminals,” said Tal Samra, cyber threat analyst at Cyberint.The rise in nefarious activity comes as users flocked to the encrypted chat app earlier this year after changes to the privacy policy of Facebook-owned rival WhatsApp prompted many to seek out alternatives.

Telegram today rolling out an update which brings with it several new features.The update also adds interactive emoji. When you send one of the select animated emoji in chat, you can now tap on it to initiate a full screen animation. The update also adds interactive emoji. When you send one of the select animated emoji in chat, you can now tap on it to initiate a full screen animation. This is then visible to you or anyone else who's also present in chat at the moment. The animations are also accompanied by vibrations. This is then visible to you or anyone else who's also present in chat at the moment. The animations are also accompanied by vibrations.

Python Turbo Уютное сообщество Python разработчиков from ru


Telegram Python Turbo. Уютное сообщество Python разработчиков.
FROM USA